package internet_03;

import java.lang.reflect.Constructor;

/*
    通过反射实现如下的操作：
        Student s = new Student("林青霞",30,"西安");
        System.out.println(s);
 */
public class Demo02 {
    public static void main(String[] args)throws Exception{
        //获取Class对象
        Class<?> c = Class.forName("myReflect.itheima_02.Student");
        //得到构造方法
        Constructor<?> con = c.getDeclaredConstructor(String.class, int.class, String.class);
        //创建对象
        Object o = con.newInstance("李白",18,"酒剑仙");
        //输出
        System.out.println(o);
    }
}
